package com.tcm.logistics.service.impl;

import com.tcm.logistics.dao.mapper.LogisticsRegionMapper;
import com.tcm.logistics.entity.LogisticsRegion;
import com.tcm.logistics.service.LogisticsRegionService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService(version = "0.0.1-alpha")
public class LogisticsRegionServiceImpl implements LogisticsRegionService {

    @Autowired
    private LogisticsRegionMapper logisticsRegionMapper;

    /**
     * 删除
     *
     * @param id
     * @return
     */
    @Override
    public int deleteById(Long id) {
        return logisticsRegionMapper.deleteByKey(id);
    }

    /**
     * 逻辑删除
     *
     * @param id
     * @return
     */
    @Override
    public int deleteLogicById(Long id) {
        return logisticsRegionMapper.deleteLogicByKey(id);
    }

    /**
     * 根据运费模板Id删除
     *
     * @param freightId
     * @return
     */
    @Override
    public int deleteByFreight(Long freightId) {
        return logisticsRegionMapper.deleteByFreight(freightId);
    }

    /**
     * 根据运费模板Id逻辑删除
     *
     * @param freightId
     * @return
     */
    @Override
    public int deleteLogicByFreight(Long freightId) {
        return logisticsRegionMapper.deleteLogicByFreight(freightId);
    }

    /**
     * 新增配送区域
     *
     * @param record
     * @return
     */
    @Override
    public int create(LogisticsRegion record) {
        return logisticsRegionMapper.insert(record);
    }

    /**
     * 更新
     *
     * @param record
     * @return
     */
    @Override
    public int updateByKey(LogisticsRegion record) {
        return logisticsRegionMapper.updateByKey(record);
    }

    /**
     * 查询配送区域列表
     *
     * @param freightId
     * @return
     */
    @Override
    public List<LogisticsRegion> listLogisticsRegion(Long freightId) {
        return logisticsRegionMapper.listLogisticsRegion(freightId);
    }
}
